class Calculator {

	public static long Sum_of_Array(int[] a) {	
		long sum = 0 ;
		for(int i=0;i<a.length;i++)
			sum = sum + a[i]; 
		return sum;
	}
	
	public static int[] rand_int(int num) {
	int[] a = new int[num];
	for(int i = 0; i<num; i++)
		a[i]=(int) (Math.random()*100);
		return a;
	}
	
	
	public static double[] rand_double(int num) {
	double[] a = new double[num];
	for(int i = 0; i<num; i++)
		a[i]=Math.random()*100;
		return a;
	}
	
	public static char[] rand_char(int num) {
	
	char temp;
	char[] a = new char[num];
	int i=0;
	while(i<num) {
		temp = (char) (Math.random()*100);
		if((temp >='a' && temp <= 'z' )||(temp >= 'A' && temp <= 'Z'))
			a[i++]=temp;	
	}
		return a;
	}
	
	public static void print_int(int[] arr) {
			for(int i=0;i<arr.length;i++)
			System.out.print(arr[i] + ",");
	}
	
	public static void print_double(double[] arr) {
			for(int i=0;i<arr.length;i++)
			System.out.print(arr[i] + ",");
	}
	
	public static void print_char(char[] arr) {
			for(int i=0;i<arr.length;i++)
			System.out.print(arr[i] + ",");
	}
	
	public static int max_arr(int[] arr) {
	
		int max=0;
		for(int i=0;i<arr.length;i++)
			if(max<arr[i])
				max = arr[i];
	
		return max;
	}
	public static int[] rev_int(int[] arr) {
	
		int[] rev = new int[arr.length];
		for(int i=0;i<arr.length;i++)
				rev[arr.length-i-1] = arr[i];
	
		return rev;
	
	}
	public static char[] rev_char(char[] arr) {
	
		char[] rev = new char[arr.length];
		for(int i=0;i<arr.length;i++)
				rev[arr.length-i-1] = arr[i];
	
		return rev;
	
	}
	
	public static int count_vowel(char[] arr) {
	
		int count=0;
		for(int i=0;i<arr.length;i++)
				if(arr[i]=='a'||arr[i]=='e'||arr[i]=='i'||arr[i]=='o'||arr[i]=='u'||
					arr[i]=='A'||arr[i]=='E'||arr[i]=='I'||arr[i]=='O'||arr[i]=='U')
					count++;
	
		return count;
	}
	
	public static int[] gen_even(int num1,int num2) {	
		int[] arr = new int[50];

		for(int i=num1,j=0;i<=num2;i++,j++)
			if(i%2==0)
				arr[j]=i;
			else
				j--;
		return arr;
	}
	
	
	public static int[] gen_odd(int num1,int num2) {
	
		int[] arr = new int[50];
		for(int i=num1,j=0;i<=num2;i++,j++)
			if(!(i%2==0))
				arr[j]=i;
			else
				j--;
		return arr;
	}
	
	public static int[] gen_prime(int num1,int num2) {
	
		int[] arr = new int[50];
		for(int i=num1,j=0;i<=num2;i++,j++)
			if(isPrime(i))
				arr[j]=i;
			else
				j--;
		return arr;
	}
	public static boolean isPrime(long num) {
		boolean result = false;
		long count = 0;
		long i=2;
		while(i <= num/2) {
		
			if(num%i == 0)
				count++;
			i++;
		}
		if(count == 0 && num != 1 && num != 0)
			result = true;
		return result;
	}
	
	public static int linear_search(int[] arr, int key) {
	
		
		int pos=-1;
		for(int i=0;i<arr.length;i++)
			if(arr[i]==key)
				pos=i+1;
				return pos;
	}
	public static int binary_search(int[] arr, int key) {
		
		int pos=-1;
		int low = 0;	
		int high = arr.length-1;
		int mid=(low+high)/2;	
		while(low <= high)
		{
			mid=(low+high)/2;		
			if(key < arr[mid])
					high = mid - 1;
			else if(key > arr[mid])
					low = mid + 1;
			else 
				{
					pos = mid+1;
					break;
				}			
		}
		return pos;		
	}	
	
	
	public static int[] gen_fibbo(int num) {
	
		int[] arr = new int[20];
		
		arr[0]=0;
		arr[1]=1;
		for(int i=2 ; i<num ;i++ )
			arr[i]=arr[i-1]+arr[i-2];
			
	
		return arr;
	}
}